]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st/icon: Use own methods for updating GIcon when setting icon names
authorJonas Dreßler <verdre@v0yd.nl>
Thu, 21 Nov 2019 12:05:04 +0000 (19:05 +0700)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 13 Jan 2020 13:44:08 +0000 (14:44 +0100)
Instead of reimplementing the functions to set the GIcon inside the
`set_*_icon_name` functions, just use the already defined methods for
that.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888

src/st/st-icon.c

index 13f7dd54ffe592c9829a0fdef1b6e6e155bbf144..8b8dbc2ff82a21990f143e4e6bb441f59d16962f 100644 (file)
@@ -549,7 +549,6 @@ void
 st_icon_set_icon_name (StIcon      *icon,
                        const gchar *icon_name)
 {
-  StIconPrivate *priv = icon->priv;
   GIcon *gicon = NULL;
 
   g_return_if_fail (ST_IS_ICON (icon));
@@ -557,26 +556,12 @@ st_icon_set_icon_name (StIcon      *icon,
   if (icon_name)
     gicon = g_themed_icon_new_with_default_fallbacks (icon_name);
 
-  if (g_icon_equal (priv->gicon, gicon)) /* do nothing */
-    {
-      if (gicon)
-        g_object_unref (gicon);
-      return;
-    }
-
-  if (priv->gicon)
-    g_object_unref (priv->gicon);
-
   g_object_freeze_notify (G_OBJECT (icon));
 
-  priv->gicon = gicon;
-
-  g_object_notify_by_pspec (G_OBJECT (icon), props[PROP_GICON]);
+  st_icon_set_gicon (icon, gicon);
   g_object_notify_by_pspec (G_OBJECT (icon), props[PROP_ICON_NAME]);
 
   g_object_thaw_notify (G_OBJECT (icon));
-
-  st_icon_update (icon);
 }
 
 /**
@@ -741,7 +726,6 @@ void
 st_icon_set_fallback_icon_name (StIcon      *icon,
                                 const gchar *fallback_icon_name)
 {
-  StIconPrivate *priv = icon->priv;
   GIcon *gicon = NULL;
 
   g_return_if_fail (ST_IS_ICON (icon));
@@ -749,19 +733,10 @@ st_icon_set_fallback_icon_name (StIcon      *icon,
   if (fallback_icon_name != NULL)
     gicon = g_themed_icon_new_with_default_fallbacks (fallback_icon_name);
 
-  if (g_icon_equal (priv->fallback_gicon, gicon)) /* do nothing */
-    {
-      if (gicon)
-        g_object_unref (gicon);
-      return;
-    }
-
-  if (priv->fallback_gicon)
-    g_object_unref (priv->fallback_gicon);
-
-  priv->fallback_gicon = gicon;
+  g_object_freeze_notify (G_OBJECT (icon));
 
+  st_icon_set_fallback_gicon (icon, gicon);
   g_object_notify_by_pspec (G_OBJECT (icon), props[PROP_FALLBACK_ICON_NAME]);
 
-  st_icon_update (icon);
+  g_object_thaw_notify (G_OBJECT (icon));
 }